#include "predef.h"
#include "ioset1.h"
#include "public.h"
#include "sysdata.h"
#include "meter.h"
#include "fileset1.h"
#include "StdPeriph_Driver.h"
#include "app.h"
#include "flashinfo.h"
#include "safedate.h"
#include "dtbit.h"

 
 
extern struct stSOFTCON stsoftcon;
extern strFlashInfo FlashInfo; 


void  DTbitSave ( void )
{
	
	u8 	i = sizeof ( FlashInfo.RunInfo.EState ) * 8 -1; 
	struct STBITSTATU   *p = (&stsoftcon.cSysBitBuff[_Dtbit_b_end]) ;
	u32 ltemp  =0 ; 
	
	do {
			ltemp *=2;
			 if (( *p).bCurr)
						ltemp++;
						p--;
	} while ( i--) ;

 
	if ( ltemp != FlashInfo.RunInfo.EState )
		lSave ( FlashInfo.RunInfo.EState,  ltemp  );
 
}
	

int  DTbitGet (  void  )
{
	u8 i ;
	u32 j ;
	u32  ltemp =   ( FlashInfo.RunInfo.EState) ;
	struct STBITSTATU *p =  &(stsoftcon.cSysBitBuff[_Dtbit_b_start] );
	
	for ( j=1, i = 0 ; i < (8 * sizeof ( FlashInfo.RunInfo.EState)) ;i++,j*=2,p++)
	{
	   if ( ltemp & j )
					(*p).bPrev = (*p).bCurr = 1 ; 
  }
}	
		